package com.beaven.imserver.net.bean.card;

import com.beaven.imserver.net.bean.db.User;
import com.google.gson.annotations.Expose;
import java.time.LocalDateTime;

/**
 * author: Beaven
 * time: 2017/5/17 21:14
 */
public class UserCard {
  @Expose
  private String id;
  @Expose
  private String name;
  @Expose
  private String account;

  // 用户关注人的数量
  @Expose
  private int follows;

  // 用户粉丝的数量
  @Expose
  private int following;

  // 用户群组的数量
  @Expose
  private int categories;

  @Expose
  private int chatColor;

  // 我与当前User的关系状态，是否已经关注了这个人
  @Expose
  private boolean isFollow;

  @Expose
  private String categoryId;

  @Expose
  private boolean isOnline;

  // 用户信息最后的更新时间
  @Expose
  private LocalDateTime modifyAt;

  public UserCard(final User user) {
    this(user, null, false);
  }

  public UserCard(User user, boolean isFollow) {
    this(user, null, isFollow);
  }

  public UserCard(final User user, String categoryId, boolean isFollow) {
    this.isFollow = isFollow;
    this.id = user.getId();
    this.name = user.getName();
    this.modifyAt = user.getUpdateAt();
    this.categoryId = categoryId;
    this.isOnline = user.getToken() != null;
    this.account = user.getAccount();
    this.chatColor = user.getChatColor();

  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getFollows() {
    return follows;
  }

  public void setFollows(int follows) {
    this.follows = follows;
  }

  public int getFollowing() {
    return following;
  }

  public void setFollowing(int following) {
    this.following = following;
  }

  public boolean isFollow() {
    return isFollow;
  }

  public void setFollow(boolean follow) {
    isFollow = follow;
  }

  public LocalDateTime getModifyAt() {
    return modifyAt;
  }

  public void setModifyAt(LocalDateTime modifyAt) {
    this.modifyAt = modifyAt;
  }

  public int getCategories() {
    return categories;
  }

  public void setCategories(int categories) {
    this.categories = categories;
  }

  public String getCategoryId() {
    return categoryId;
  }

  public void setCategoryId(String categoryId) {
    this.categoryId = categoryId;
  }

  public boolean isOnline() {
    return isOnline;
  }

  public String getAccount() {
    return account;
  }

  public void setAccount(String account) {
    this.account = account;
  }

  public void setOnline(boolean online) {
    isOnline = online;
  }
}
